//use "C:\Users\mjoshi2\Desktop\Working Projects\Post-Accord Violence and Peacebuilding\CMPS\Data\nepaldata-updatedwith-preelection violenceV.2.dta", clear

log using "C:\Users\mjoshi2.DSS-OKIU3QJMAS9\Desktop\Accepted-Final Articles 2014\Civil Wars\Webdata\CW2014.smcl", replace 

label variable maoist_event "Post-Accord Violence by Maoists"
label variable bystate_2006 "Killed by State during Insurgency"
label variable bymaoist_2006 "Killed by Maoists during Insurgency"
label variable not_claimedevent "Post-Accord Violence not Claimed"
label variable ethnic_event "Post-Accord Ethnic Group Violence"
label variable landless_gap "% Landless Gap"
label variable road_density "Road Density"
label variable gap_institutional_credit "% Access to Institutional Credit Gap"
label variable ln_pop2001 "Log Population 2001"
label variable hdi_2001 "HDI 2001"
label variable  abs_total "Absentee Population (1000)"
label variable region_east "East Region"
label variable region_west "West Region "
label variable region_midwest "Midwest Region"
label variable region_farwest "Far West Region"



set more off
//TABLE 1 MODELS
//Table 1/Model 1
nbreg  maoist_event   bystate_2006 bymaoist_2006 not_claimedevent ethnic_event landless_gap  road_density  gap_institutional_credit ln_pop2001, r
//Table 1/Model 2
nbreg  maoist_event   bystate_2006 bymaoist_2006  landless_gap  road_density  gap_institutional_credit hdi_2001  abs_total ln_pop2001, r
//Table 1//Model 3
nbreg  maoist_event   bystate_2006 bymaoist_2006  landless_gap  road_density  gap_institutional_credit ln_pop2001 region_east region_west region_midwest region_farwest, r
//Table 1//Model 4
nbreg  maoist_event   bystate_2006 bymaoist_2006  landless_gap  road_density  gap_institutional_credit hdi_2001  ln_pop2001, r

//TABLE 2 MODELS
//Table 2/FPTP votes model 1 & 2
reg maoistvote2008_1000 ncvote2008_1000 cpnumlvote2008_1000 no_candidates_2008 maoist_event  bystate_2006 bymaoist_2006  not_claimedevent ethnic_event road_density landless_gap gap_institutional_credit ln_pop2001 hdi_2001, r
reg maoistvote2008_1000 ncvote2008_1000 cpnumlvote2008_1000 no_candidates_2008 maoist_event  bystate_2006 bymaoist_2006  landless_gap gap_institutional_credit ln_pop2001 hdi_2001, r

//Table 2/PR votes model 3&4 
reg prv_maoist2008_1000 prv_nc2008_1000 prv_uml2008_1000 maoist_event  bystate_2006 bymaoist_2006  not_claimedevent ethnic_event road_density landless_gap gap_institutional_credit ln_pop2001 hdi_2001, r
reg prv_maoist2008_1000 prv_nc2008_1000 prv_uml2008_1000 maoist_event  bystate_2006 bymaoist_2006  landless_gap gap_institutional_credit ln_pop2001 hdi_2001, r

//TABLE 3 - EFFECT ON FPTP SEATS model 1, 2, & 3

nbreg seat_cpnm_2008 seat_nc2008 seat_cpnuml_2008 landless_gap no_candidates_2008 maoist_event   not_claimedevent ethnic_event   bystate_2006  bymaoist_2006 ln_pop2001 hdi_2001 gap_institutional_credit, r
nbreg seat_cpnm_2008 seat_nc2008 seat_cpnuml_2008 road_density maoist_event   ethnic_event   bystate_2006  bymaoist_2006 ln_pop2001 hdi_2001, r
nbreg seat_cpnm_2008 seat_nc2008 seat_cpnuml_2008 road_density maoist_event   bystate_2006  bymaoist_2006 ln_pop2001, r


////////////////////end///////////

//Table 1/Model 2
nbreg  maoist_event   bystate_2006 bymaoist_2006 landless_gap  road_density  gap_institutional_credit ln_pop2001 hdi_2001
//Table 2/predicting Maoist Events based on Model 2
mfx compute, at(mean, bystate_2006= 0)
mfx compute, at(mean, bystate_2006= 733)
mfx compute, at(mean, bymaoist_2006= 0)
mfx compute, at(mean, bymaoist_2006= 266)
mfx compute, at(mean, not_claimedevent = 0)
mfx compute, at(mean, not_claimedevent = 31)
mfx compute, at(mean, ethnic_event = 0)
mfx compute, at(mean, ethnic_event = 75)
mfx compute, at(mean, landless_gap= -11.684)
mfx compute, at(mean, landless_gap= 169.908)
mfx compute, at(mean, ln_pop2001= 9.168)
mfx compute, at(mean, ln_pop2001= 13.894)
mfx compute, at(mean, hdi_2001= 0.21)
mfx compute, at(mean, hdi_2001= .652)
mfx compute, at(mean, gap_institutional_credit = -22.199)
mfx compute, at(mean, gap_institutional_credit = 46.481)
mfx compute, at(mean, road_density = 0)
mfx compute, at(mean, road_density = 2.0578)

//nbreg  maoist_event   bystate_2006 bymaoist_2006 landless_gap  road_density  gap_institutional_credit ln_pop2001 hdi_2001  region_east region_west region_midwest region_farwest


//Table 2/Model 1&2/FPTP Votes
reg maoistvote2008_1000 ncvote2008_1000 cpnumlvote2008_1000 no_candidates_2008 maoist_event  bystate_2006 bymaoist_2006  not_claimedevent ethnic_event road_density landless_gap gap_institutional_credit ln_pop2001 hdi_2001, r
reg maoistvote2008_1000 ncvote2008_1000 cpnumlvote2008_1000 no_candidates_2008 maoist_event  bystate_2006 bymaoist_2006  landless_gap gap_institutional_credit ln_pop2001 hdi_2001, r

//Table 2/Model 3&4/PR Votes
reg prv_maoist2008_1000 prv_nc2008_1000 prv_uml2008_1000 maoist_event  bystate_2006 bymaoist_2006  not_claimedevent ethnic_event road_density landless_gap gap_institutional_credit ln_pop2001 hdi_2001, r
reg prv_maoist2008_1000 prv_nc2008_1000 prv_uml2008_1000 maoist_event  bystate_2006 bymaoist_2006  landless_gap gap_institutional_credit ln_pop2001 hdi_2001, r

//Table 3/FPTP Seats/Maoist
nbreg seat_cpnm_2008 seat_nc2008 seat_cpnuml_2008 landless_gap no_candidates_2008 maoist_event   not_claimedevent ethnic_event   bystate_2006  bymaoist_2006 ln_pop2001 hdi_2001 gap_institutional_credit, r
nbreg seat_cpnm_2008 seat_nc2008 seat_cpnuml_2008 road_density maoist_event   ethnic_event   bystate_2006  bymaoist_2006 ln_pop2001 hdi_2001, r
nbreg seat_cpnm_2008 seat_nc2008 seat_cpnuml_2008 road_density maoist_event   bystate_2006  bymaoist_2006 ln_pop2001, r


//Prediction of Seats based on Model 2 in Table 3


mfx compute, at(mean, maoist_event=0)
mfx compute, at(mean, maoist_event=26)
//mfx compute, at(mean, not_claimedevent= 0)
//mfx compute, at(mean, not_claimedevent= 31)
mfx compute, at(mean, ethnic_event = 0)
mfx compute, at(mean, ethnic_event = 75)
mfx compute, at(mean, seat_nc2008 = 0)
mfx compute, at(mean, seat_nc2008 = 6)
mfx compute, at(mean, seat_cpnuml_2008 = 0)
mfx compute, at(mean, seat_cpnuml_2008 = 2)
mfx compute, at(mean, bystate_2006= 0)
mfx compute, at(mean, bystate_2006= 733)
mfx compute, at(mean, bymaoist_2006= 0)
mfx compute, at(mean, bymaoist_2006= 266)
mfx compute, at(mean, hdi_2001= 0.21)
mfx compute, at(mean, hdi_2001= .652)
mfx compute, at(mean, ln_pop2001= 9.168)
mfx compute, at(mean, ln_pop2001= 13.894)
//mfx compute, at(mean, landless_gap= -11.684)
//mfx compute, at(mean, landless_gap= 169.908)
//mfx compute, at(mean, no_candidates_2008 = 3)
//mfx compute, at(mean, no_candidates_2008= 310)
//mfx compute, at(mean, gap_institutional_credit = -22.199)
//mfx compute, at(mean, gap_institutional_credit = 46.481)
mfx compute, at(mean, road_density = 0)
mfx compute, at(mean, road_density = 2.0578)

log close
